package co.fitstart.entity.market;

import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

import co.fitstart.entity.user.User;

/**
 * 积分增减记录
 * 
 * @author dan
 *
 */
@Entity
@Table(name = "credit_record")
@JsonIgnoreProperties(value={"hibernate_lazy_initializer","handler","fieldHandler"})
public class CreditRecord {
    
    @Id
    @GeneratedValue
    private Long id;
    
    /** 创建时间 */
    private Date createTime;
    
    /** 增减数额 */
    private int credit;
    
    /** 增减描述 */
    private String description;
    
    @ManyToOne(fetch = FetchType.LAZY, optional = false)
    private User user;
    
    /**
     * The default constructor
     */
    public CreditRecord() {
        
    }
    
    /**
     * 
     * @param credit
     * @param description
     * @param user
     */
    public CreditRecord(int credit, String description, User user) {
        this.credit = credit;
        this.createTime = new Date();
        this.description = description;
        this.user = user;
    }

    /**
     * @return the id
     */
    public Long getId() {
        return id;
    }

    /**
     * @return the createTime
     */
    public Date getCreateTime() {
        return createTime;
    }

    /**
     * @return the credit
     */
    public int getCredit() {
        return credit;
    }

    /**
     * @return the description
     */
    public String getDescription() {
        return description;
    }

    /**
     * @return the user
     */
    public User getUser() {
        return user;
    }

    /**
     * @param id the id to set
     */
    public void setId(Long id) {
        this.id = id;
    }

    /**
     * @param createTime the createTime to set
     */
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    /**
     * @param credit the credit to set
     */
    public void setCredit(int credit) {
        this.credit = credit;
    }

    /**
     * @param description the description to set
     */
    public void setDescription(String description) {
        this.description = description;
    }

    /**
     * @param user the user to set
     */
    public void setUser(User user) {
        this.user = user;
    }

}
